package com.suyafei.hot.service.impl;

import com.suyafei.hot.service.HotService;
import com.suyafei.hot.utils.HotJDBC;
import org.springframework.stereotype.Service;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * @program: hot
 * @description
 * @author: luffy
 * @create: 2020-12-15 10:10
 */
@Service
public class HotServiceImpl implements HotService {

    @Override
    public String getHotMsg() {
        String name = null;
        try {
            Connection conn = HotJDBC.getConn();
            String sql = "select * from hot";
            Statement statement = conn.createStatement();
            ResultSet resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
                name = resultSet.getString("name");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return name;
    }
}
